package site.wuao.simpledesignmode.proxy.Dynamic;

import java.lang.reflect.Proxy;

import site.wuao.simpledesignmode.proxy.IShop;
import site.wuao.simpledesignmode.proxy.LiuWangShu;


/**
 * 客户端类
 *
 * @author wuao
 * @date 2018.04.16
 * @note -
 * ---------------------------------------------------------------------------------------------------------------------
 * @modified -
 * @date -
 * @note -
 */
public class Client {
    public static void main(String[] args){
        IShop liuWangShu = new LiuWangShu();
        DynamicPurchasing dynamicPurchasing = new DynamicPurchasing(liuWangShu);
        IShop purchasing = (IShop) Proxy.newProxyInstance(liuWangShu.getClass().getClassLoader(), new Class[]{IShop.class}, dynamicPurchasing);
        purchasing.buy();
    }
}
